home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / e / EasyPLUGINs.lha / EasyPLUGINs / examples / text_demo.e < prev    next >
Text File  |  1997-11-22  |  2KB  |  88 lines

  1.  
  2. /*
  3.  
  4.     text_demo: example program for text_plugin
  5.  
  6. */
  7.  
  8. OPT PREPROCESS, OSVERSION=37
  9.  
  10. MODULE 'tools/easygui', 'easyplugins/text', 'graphics/text',
  11.        'utility', 'utility/tagitem'
  12.  
  13. DEF text_a:PTR TO text_plugin, text_b:PTR TO text_plugin,
  14.     text_c:PTR TO text_plugin, text_d:PTR TO text_plugin,
  15.     disabled=FALSE, bars=FALSE
  16.  
  17. PROC main() HANDLE
  18.  
  19.     DEF ta:PTR TO textattr, font:PTR TO LONG
  20.  
  21.     IF (utilitybase:=OpenLibrary('utility.library', 37))=NIL THEN Raise("utlb")
  22.  
  23.     ta:=['topaz.font', 8, FS_NORMAL, FPB_ROMFONT]:textattr
  24.  
  25.     font:=OpenFont(ta)
  26.  
  27.     NEW text_a.text([PLA_Text_Text, 'Example 1 - Window''s font...',
  28.                      TAG_DONE])
  29.  
  30.     NEW text_b.text([PLA_Text_Text, 'Example 2 - Left justified',
  31.                      PLA_Text_Justification, PLV_Text_JustifyLeft,
  32.                      TAG_DONE])
  33.  
  34.     NEW text_c.text([PLA_Text_Text, 'Example 3 - Right justified',
  35.                      PLA_Text_Justification, PLV_Text_JustifyRight,
  36.                      TAG_DONE])
  37.  
  38.     NEW text_d.text([PLA_Text_Text, 'Example 4 - topaz.font/8',
  39.                      PLA_Text_Justification, PLV_Text_JustifyCenter,
  40.                      PLA_Text_Font, ta,
  41.                      TAG_DONE])
  42.  
  43.     easyguiA('text_plugin examples',
  44.              [ROWS,
  45.                  [PLUGIN, 1, text_a],
  46.                  [PLUGIN, 1, text_b],
  47.                  [PLUGIN, 1, text_c],
  48.                  [PLUGIN, 1, text_d],
  49.                  [COLS,
  50.                     [CHECK, {toggle_disabled}, '_Disabled?', disabled, FALSE, -1, "d"],
  51.                     [CHECK, {toggle_bars}, '_Bars?', bars, FALSE, -1, "b"],
  52.                     [SPACEH],
  53.                     [BUTTON, 0, 'Quit']
  54.                  ]
  55.              ])
  56.  
  57. EXCEPT DO
  58.  
  59.     END text_a, text_b, text_c, text_d
  60.  
  61.     IF font THEN CloseFont(font)
  62.  
  63.     IF utilitybase THEN CloseLibrary(utilitybase)
  64.  
  65. ENDPROC
  66.  
  67. PROC toggle_disabled()
  68.  
  69.     IF disabled THEN disabled:=FALSE ELSE disabled:=TRUE
  70.  
  71.     text_a.set(PLA_Text_Disabled, disabled)
  72.     text_b.set(PLA_Text_Disabled, disabled)
  73.     text_c.set(PLA_Text_Disabled, disabled)
  74.     text_d.set(PLA_Text_Disabled, disabled)
  75.  
  76. ENDPROC
  77.  
  78. PROC toggle_bars()
  79.  
  80.     IF bars THEN bars:=FALSE ELSE bars:=TRUE
  81.  
  82.     text_a.set(PLA_Text_DrawBar, bars)
  83.     text_b.set(PLA_Text_DrawBar, bars)
  84.     text_c.set(PLA_Text_DrawBar, bars)
  85.     text_d.set(PLA_Text_DrawBar, bars)
  86.  
  87. ENDPROC
  88.